# CMake 最低版本号要求
cmake_minimum_required (VERSION 2.8)
# 工程名
PROJECT(cmake-demo-src)
# 手动加入文件
SET(SRC_LIST main.c)
MESSAGE(STATUS "THIS IS BINARY " ${PROJECT_BINARY_DIR})
MESSAGE(STATUS "THIS IS SOURCE " ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "THIS IS CMAKE CMAKE_CURRENT_SOURCE_DIR " ${CMAKE_CURRENT_SOURCE_DIR})

# 添加头文件路径
# INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/dir1")
# 相对路径的方式
INCLUDE_DIRECTORIES(dir1)

MESSAGE(STATUS "CMAKE_CURRENT_SOURCE_DIR -> " ${CMAKE_CURRENT_SOURCE_DIR})
# 添加 dir1 子目录
# ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/dir1")
ADD_SUBDIRECTORY(dir1)


# 添加头文件路径
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/dir2")
# 添加 dir2 子目录
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/dir2")

ADD_EXECUTABLE(cmake-demo ${SRC_LIST})
TARGET_LINK_LIBRARIES(cmake-demo dir1 dir2)

# 将执行文件安装到bin目录下
INSTALL(TARGETS cmake-demo DESTINATION bin)